<?php

/*
 * Object/AvenantHistory.php
 */

namespace RHX\Model\Object;

use Zend\Db\Adapter\Adapter;

class AvenantHistory {

    public $id;
    public $matricule;
    public $avenant_id;
    public $num;
    public $commentaire;
    protected $adapter;

    public function __construct(Adapter $adapter, $data = array()) {
	$this->exchangeArray($data);
	$this->adapter = $adapter;
    }

    public function exchangeArray($data) {
	$this->id		 = isset($data['id']) ? $data['id'] : null;
	$this->matricule	 = isset($data['matricule']) ? $data['matricule'] : 0;
	$this->avenant_id	 = isset($data['avenant_id']) ? $data['avenant_id'] : 0;
	$this->num		 = isset($data['num']) ? $data['num'] : 0;
	$this->commentaire	 = isset($data['commentaire']) ? $data['commentaire'] : '';
    }

    public function getArrayCopy() {
	return get_object_vars($this);
    }

    /**
     * Avenant
     * 
     * @return Avenant
     */
    public function getAvenant() {
	// Table Avenant
	$avenantTable = new \RHX\Model\Table\AvenantTable($this->adapter);

	return $avenantTable->get($this->avenant_id);
    }

    /**
     * Employé
     *
     * @return Employe
     */
    public function getEmploye() {
	// Table Employé
	$employeTable = new \RHX\Model\Table\EmployeTable($this->adapter);

	return $employeTable->get($this->matricule);
    }

}

?>
